<?php
$this->breadcrumbs=array(
	'Users',
);?>
<h1>Usuarios</h1>

<?php echo CHtml::link("Nuevo", array("create"))?>

<table>
	<tr>
		<th>photo</th>
		<th>id</th>
		<th>id FB</th>
		<th>name</th>
		<th>invitations</th>
		<th>edit</th>
		<th>delete</th>
	</tr>
	<?php
	foreach($users as $user){
		echo "<tr>";
		
		if (strlen($user->photo_path) == 0){
			echo "<td><img style='width:120px;height:120px;' src='".Yii::app()->baseUrl."/images/noimage.jpg' /></td>";
		} else {
			echo "<td><img style='width:120px;height:120px;' src='".Yii::app()->baseUrl."/".Yii::app()->params["uploads"]."/".$user->photo_path."' /></td>";	
		}
		
		echo "<td>".$user->id."</td>";
		echo "<td>".$user->id_facebook."</td>";
		echo "<td>".$user->name."</td>";
		echo "<td>";
			foreach($user->invitations as $invitation){
				echo $invitation->state."<br>";
			}
		echo "</td>";
		echo "<td>".CHtml::link("Edit", array("update", "id" => $user->id))."</td>";
		echo "<td>".CHtml::link("Delete", array("delete", "id" => $user->id), array("confirm" => "Seguro?"))."</td>";
		echo "</tr>";
	}
	?>
</table>
